
import json,os

# 实现一个算法：识别一个字符串中，是否包含唯一的字符。
class UniqueChars(object):
    def has_unique_chars(self, string):
        if string is None:
            return False
        return len(set(string)) == len(string)

# 确定字符串是否是另一个的排列
class Permutations(object):
    def is_permutation(self, str1, str2):
        if str1 is None or str2 is None:
            return False
        print(sorted(str1))
        print(sorted(str2))
        return sorted(str1) == sorted(str2)

# 实现一个算法来实现反转字符数组的功能。反转的要求如下：
class ReverseString(object):
    def reverse(self, chars):
        if chars:
            size = len(chars)
            print('size // 2:',size // 2)
            for i in range(size // 2):
                print('i:',i)
                print('size - 1 - i:',size - 1 - i)
                print('chars[size - 1 - i]:',chars[size - 1 - i])
                chars[i], chars[size - 1 - i] = chars[size - 1 - i], chars[i]
                print(chars)
                # print(chars[i])
                # print(chars[size - 1 - i])
        return chars

# 给定一个整数 num，从 1 到 num 按照下面的规则返回每个数：
#
# 如果这个数被 3 整除，返回 'Fizz'。
# 如果这个数被 5 整除，返回 'Buzz'。
# 如果这个数能同时被 3 和 5 整除，返回 'FizzBuzz'。
# 如果这个数既不能被 3 也不能被 5 整除，返回这个数字的字符串格式。

class Solution(object):
    def fizz_buzz(self, num):
        if num is None:
            raise TypeError('num cannot be None')
        if num < 1:
            raise ValueError('num cannot be less than one')
        results = []
        for i in range(1, num + 1):
            if i % 3 == 0 and i % 5 == 0:
                results.append('FizzBuzz')
            elif i % 3 == 0:
                results.append('Fizz')
            elif i % 5 == 0:
                results.append('Buzz')
            else:
                results.append(str(i))
        return results

def row_list(list, number, symbol, judge):
    like = []
    diff = True
    for value in list:
        print(value.text)
        el_table_row_list = value.text.split(symbol)
        if none_pass(el_table_row_list, judge):
            pass
        else:
            diff = False
        like.append(el_table_row_list[number])
    return diff, like

def sort_diff(list):
    diff = True
    a = None
    b = None
    for i in range(len(list)):
        for j in range(0, len(list) - 1):
            if (list[j][-1] != 'w' and list[j][-1] != '亿') and (list[j + 1][-1] != 'w' and list[j + 1][-1] != '亿'):
                a = float(list[j])
                b = float(list[j + 1])
                if a < b:
                    diff = False
            elif list[j][-1] == list[j + 1][-1]:
                if float(list[j][:-1]) > float(list[j + 1][:-1]) or float(list[j][:-1]) == float(
                        list[j + 1][:-1]):
                    pass
                else:
                    diff = False

            elif list[j][-1] < list[j + 1][-1]:
                diff = False
    return diff

def none_pass(list_value, judge):
    list_text = ['-', '', ' ', '0', '_', 'Nan', 0]
    list_text = judge
    print(list_value)
    for value in list_value:
        if value in list_text:
            return False
        elif value[0] == '-':
            return False

        elif value[0] == '￥' and value[1] == ' ':

            if '-' in value:
                return False
            for judge_value in list_text:
                if judge_value == value[2:]:
                    return False

        elif value[0] == '￥':
            if '-' in value:
                return False
            for judge_value in list_text:
                if judge_value == value[1:]:
                    return False

    return True

def row_list(list, number, symbol, judge):
    like = []
    diff = True
    for value in list:
        print(value.text)
        el_table_row_list = value.text.split(symbol)
        if none_pass(el_table_row_list, judge):
            pass
        else:
            diff = False
        like.append(el_table_row_list[number])
    return diff, like

if __name__ == "__main__":

    # video_list=['09', '26s', '77.9w', '1.9w', '4.8w', '浪起万三', '2天前7.9w']
    # judge = ['0', 'Nan', '0', 0]

    #第一题：排序
    judge = ['0', '1w', '-1', '1亿','1000','999','1000w']

    #第二题：判断数组内不能出现空、0、"0"、"-"、"--"
    judge = ['09', '26s', '77.9w', '1.9w', '4.8w', '浪起万三', '2天前7.9w']

    #第三题：成抖查查首页手机号密码登录接口抓取 用requests请求 拿回返回值并打印

    #第四题：完成抖查查首页手机号密码登录接口抓取 用requests请求 拿回返回值把返回值内容通过邮件方式发送到自己得企业邮

    #第五题：UI自动化抖查查首页完成自动化登录进入首页 -实时直播榜-实时销售额榜单

    #第六题：UI自动化抖查查首页完成自动化登录进入首页 -实时直播榜-实时销售额榜单-拿到排名1得所有数据


    # print(none_pass(video_list, judge))







